/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.bopet.jocadv.core;

/**
 * The class collects utilities useful for working with vectors
 *
 * @author bocskapeter
 */
public class VectorUtil {

    /**
     *
     * Gives the index of the vector where the absolute coordinate value the
     * biggest
     *
     * @param vector
     * @return index of the biggest absolute value
     */
    public static int getIndexOfBiggestAbsCoord(double[] vector) {
        double maximumValue = Math.abs(vector[0]);
        int indexOfMaximumValue = 0;
        for (int i = 1; i < vector.length; i++) {
            if (Math.abs(vector[i]) > maximumValue) {
                indexOfMaximumValue = i;
            }
        }
        return indexOfMaximumValue;
    }

}
